﻿using System;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using CorreoSocialWeb.Models;

using System.Collections.Generic;
using System.Linq;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration.Conventions;


namespace CorreoSocialWeb.Models
{
    public class CorreoSocialDbContext : IdentityDbContext<ApplicationUser>
    {
        /* seguir la regla de pluralización: agregar simplemente una "s" */
        /* salvo que se aclare en la clase explicitamente */

        public DbSet<Usuario> Usuarios { get; set; }
        public DbSet<Ruta> Rutas { get; set; }
        public DbSet<Envio> Envios { get; set; }
        public DbSet<TamanoDePaquete> TamanoDePaquetes { get; set; }
        public DbSet<Provincia> Provincias { get; set; }
        public DbSet<Domicilio> Domicilios { get; set; }
        public DbSet<Partido> Partidos { get; set; }
        public DbSet<Calificacion> Calificaciones { get; set; }
        public DbSet<RutaDeEnvio> RutasDeEnvio { get; set; }
        
        public CorreoSocialDbContext() : base("DefaultConnection", throwIfV1Schema: false)
        {
            
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);

            //modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }

        public static CorreoSocialDbContext Create()
        {
            return new CorreoSocialDbContext();
        }
    }
}
